home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 86
/
(Vol 86) My Disc.iso
/
Games
/
pet_1112.swf
/
scripts
/
__Packages
/
caurina
/
transitions
/
SpecialPropertiesDefault.as
< prev
next >
Wrap
Text File
|
2009-04-14
|
12KB
|
283 lines
class caurina.transitions.SpecialPropertiesDefault
{
function SpecialPropertiesDefault()
{
trace("SpecialProperties is an static class and should not be instantiated.");
}
static function init()
{
caurina.transitions.Tweener.registerSpecialProperty("_frame",caurina.transitions.SpecialPropertiesDefault._frame_get,caurina.transitions.SpecialPropertiesDefault._frame_set);
caurina.transitions.Tweener.registerSpecialProperty("_sound_volume",caurina.transitions.SpecialPropertiesDefault._sound_volume_get,caurina.transitions.SpecialPropertiesDefault._sound_volume_set);
caurina.transitions.Tweener.registerSpecialProperty("_sound_pan",caurina.transitions.SpecialPropertiesDefault._sound_pan_get,caurina.transitions.SpecialPropertiesDefault._sound_pan_set);
caurina.transitions.Tweener.registerSpecialProperty("_color_ra",caurina.transitions.SpecialPropertiesDefault._color_property_get,caurina.transitions.SpecialPropertiesDefault._color_property_set,["ra"]);
caurina.transitions.Tweener.registerSpecialProperty("_color_rb",caurina.transitions.SpecialPropertiesDefault._color_property_get,caurina.transitions.SpecialPropertiesDefault._color_property_set,["rb"]);
caurina.transitions.Tweener.registerSpecialProperty("_color_ga",caurina.transitions.SpecialPropertiesDefault._color_property_get,caurina.transitions.SpecialPropertiesDefault._color_property_set,["ga"]);
caurina.transitions.Tweener.registerSpecialProperty("_color_gb",caurina.transitions.SpecialPropertiesDefault._color_property_get,caurina.transitions.SpecialPropertiesDefault._color_property_set,["gb"]);
caurina.transitions.Tweener.registerSpecialProperty("_color_ba",caurina.transitions.SpecialPropertiesDefault._color_property_get,caurina.transitions.SpecialPropertiesDefault._color_property_set,["ba"]);
caurina.transitions.Tweener.registerSpecialProperty("_color_bb",caurina.transitions.SpecialPropertiesDefault._color_property_get,caurina.transitions.SpecialPropertiesDefault._color_property_set,["bb"]);
caurina.transitions.Tweener.registerSpecialProperty("_color_aa",caurina.transitions.SpecialPropertiesDefault._color_property_get,caurina.transitions.SpecialPropertiesDefault._color_property_set,["aa"]);
caurina.transitions.Tweener.registerSpecialProperty("_color_ab",caurina.transitions.SpecialPropertiesDefault._color_property_get,caurina.transitions.SpecialPropertiesDefault._color_property_set,["ab"]);
caurina.transitions.Tweener.registerSpecialProperty("_autoAlpha",caurina.transitions.SpecialPropertiesDefault._autoAlpha_get,caurina.transitions.SpecialPropertiesDefault._autoAlpha_set);
caurina.transitions.Tweener.registerSpecialPropertySplitter("_color",caurina.transitions.SpecialPropertiesDefault._color_splitter);
caurina.transitions.Tweener.registerSpecialPropertySplitter("_colorTransform",caurina.transitions.SpecialPropertiesDefault._colorTransform_splitter);
caurina.transitions.Tweener.registerSpecialPropertySplitter("_scale",caurina.transitions.SpecialPropertiesDefault._scale_splitter);
caurina.transitions.Tweener.registerSpecialProperty("_blur_blurX",caurina.transitions.SpecialPropertiesDefault._filter_property_get,caurina.transitions.SpecialPropertiesDefault._filter_property_set,[flash.filters.BlurFilter,"blurX"]);
caurina.transitions.Tweener.registerSpecialProperty("_blur_blurY",caurina.transitions.SpecialPropertiesDefault._filter_property_get,caurina.transitions.SpecialPropertiesDefault._filter_property_set,[flash.filters.BlurFilter,"blurY"]);
caurina.transitions.Tweener.registerSpecialProperty("_blur_quality",caurina.transitions.SpecialPropertiesDefault._filter_property_get,caurina.transitions.SpecialPropertiesDefault._filter_property_set,[flash.filters.BlurFilter,"quality"]);
caurina.transitions.Tweener.registerSpecialPropertySplitter("_filter",caurina.transitions.SpecialPropertiesDefault._filter_splitter);
caurina.transitions.Tweener.registerSpecialPropertyModifier("_bezier",caurina.transitions.SpecialPropertiesDefault._bezier_modifier,caurina.transitions.SpecialPropertiesDefault._bezier_get);
}
static function _color_splitter(p_value)
{
var _loc1_ = new Array();
if(p_value == null)
{
_loc1_.push({name:"_color_ra",value:100});
_loc1_.push({name:"_color_rb",value:0});
_loc1_.push({name:"_color_ga",value:100});
_loc1_.push({name:"_color_gb",value:0});
_loc1_.push({name:"_color_ba",value:100});
_loc1_.push({name:"_color_bb",value:0});
}
else
{
_loc1_.push({name:"_color_ra",value:0});
_loc1_.push({name:"_color_rb",value:caurina.transitions.AuxFunctions.numberToR(p_value)});
_loc1_.push({name:"_color_ga",value:0});
_loc1_.push({name:"_color_gb",value:caurina.transitions.AuxFunctions.numberToG(p_value)});
_loc1_.push({name:"_color_ba",value:0});
_loc1_.push({name:"_color_bb",value:caurina.transitions.AuxFunctions.numberToB(p_value)});
}
return _loc1_;
}
static function _colorTransform_splitter(p_value)
{
var _loc2_ = new Array();
if(p_value == null)
{
_loc2_.push({name:"_color_ra",value:100});
_loc2_.push({name:"_color_rb",value:0});
_loc2_.push({name:"_color_ga",value:100});
_loc2_.push({name:"_color_gb",value:0});
_loc2_.push({name:"_color_ba",value:100});
_loc2_.push({name:"_color_bb",value:0});
}
else
{
if(p_value.ra != undefined)
{
_loc2_.push({name:"_color_ra",value:p_value.ra});
}
if(p_value.rb != undefined)
{
_loc2_.push({name:"_color_rb",value:p_value.rb});
}
if(p_value.ga != undefined)
{
_loc2_.push({name:"_color_ba",value:p_value.ba});
}
if(p_value.gb != undefined)
{
_loc2_.push({name:"_color_bb",value:p_value.bb});
}
if(p_value.ba != undefined)
{
_loc2_.push({name:"_color_ga",value:p_value.ga});
}
if(p_value.bb != undefined)
{
_loc2_.push({name:"_color_gb",value:p_value.gb});
}
if(p_value.aa != undefined)
{
_loc2_.push({name:"_color_aa",value:p_value.aa});
}
if(p_value.ab != undefined)
{
_loc2_.push({name:"_color_ab",value:p_value.ab});
}
}
return _loc2_;
}
static function _scale_splitter(p_value)
{
var _loc1_ = new Array();
_loc1_.push({name:"_xscale",value:p_value});
_loc1_.push({name:"_yscale",value:p_value});
return _loc1_;
}
static function _filter_splitter(p_value)
{
var _loc1_ = new Array();
if(p_value instanceof flash.filters.BlurFilter)
{
_loc1_.push({name:"_blur_blurX",value:flash.filters.BlurFilter(p_value).blurX});
_loc1_.push({name:"_blur_blurY",value:flash.filters.BlurFilter(p_value).blurY});
_loc1_.push({name:"_blur_quality",value:flash.filters.BlurFilter(p_value).quality});
}
else
{
trace("??");
}
return _loc1_;
}
static function _frame_get(p_obj)
{
return p_obj._currentFrame;
}
static function _frame_set(p_obj, p_value)
{
p_obj.gotoAndStop(Math.round(p_value));
}
static function _sound_volume_get(p_obj)
{
return p_obj.getVolume();
}
static function _sound_volume_set(p_obj, p_value)
{
p_obj.setVolume(p_value);
}
static function _sound_pan_get(p_obj)
{
return p_obj.getPan();
}
static function _sound_pan_set(p_obj, p_value)
{
p_obj.setPan(p_value);
}
static function _color_property_get(p_obj, p_parameters)
{
return new Color(p_obj).getTransform()[p_parameters[0]];
}
static function _color_property_set(p_obj, p_value, p_parameters)
{
var _loc1_ = new Object();
_loc1_[p_parameters[0]] = Math.round(p_value);
new Color(p_obj).setTransform(_loc1_);
}
static function _autoAlpha_get(p_obj)
{
return p_obj._alpha;
}
static function _autoAlpha_set(p_obj, p_value)
{
p_obj._alpha = p_value;
p_obj._visible = p_value > 0;
}
static function _filter_property_get(p_obj, p_parameters)
{
var _loc2_ = p_obj.filters;
var _loc1_ = undefined;
var _loc4_ = p_parameters[0];
var _loc3_ = p_parameters[1];
_loc1_ = 0;
while(_loc1_ < _loc2_.length)
{
if(_loc2_[_loc1_] instanceof _loc4_)
{
return _loc2_[_loc1_][_loc3_];
}
_loc1_ = _loc1_ + 1;
}
var _loc5_ = undefined;
var _loc0_ = null;
if((_loc0_ = _loc4_) === flash.filters.BlurFilter)
{
_loc5_ = {blurX:0,blurY:0,quality:NaN};
}
return _loc5_[_loc3_];
}
static function _filter_property_set(p_obj, p_value, p_parameters)
{
var _loc2_ = p_obj.filters;
var _loc1_ = undefined;
var _loc4_ = p_parameters[0];
var _loc3_ = p_parameters[1];
_loc1_ = 0;
while(_loc1_ < _loc2_.length)
{
if(_loc2_[_loc1_] instanceof _loc4_)
{
_loc2_[_loc1_][_loc3_] = p_value;
p_obj.filters = _loc2_;
return undefined;
}
_loc1_ = _loc1_ + 1;
}
if(_loc2_ == undefined)
{
_loc2_ = new Array();
}
var _loc7_ = undefined;
var _loc0_ = null;
if((_loc0_ = _loc4_) === flash.filters.BlurFilter)
{
_loc7_ = new flash.filters.BlurFilter(0,0);
}
_loc7_[_loc3_] = p_value;
_loc2_.push(_loc7_);
p_obj.filters = _loc2_;
}
static function _bezier_modifier(p_obj)
{
var _loc7_ = [];
var _loc4_ = undefined;
if(p_obj instanceof Array)
{
_loc4_ = p_obj;
}
else
{
_loc4_ = [p_obj];
}
var _loc3_ = undefined;
var _loc1_ = undefined;
var _loc2_ = {};
_loc3_ = 0;
while(_loc3_ < _loc4_.length)
{
for(_loc1_ in _loc4_[_loc3_])
{
if(_loc2_[_loc1_] == undefined)
{
_loc2_[_loc1_] = [];
}
_loc2_[_loc1_].push(_loc4_[_loc3_][_loc1_]);
}
_loc3_ = _loc3_ + 1;
}
for(_loc1_ in _loc2_)
{
_loc7_.push({name:_loc1_,parameters:_loc2_[_loc1_]});
}
return _loc7_;
}
static function _bezier_get(b, e, t, p)
{
if(p.length == 1)
{
return b + t * (2 * (1 - t) * (p[0] - b) + t * (e - b));
}
var _loc2_ = Math.floor(t * p.length);
var _loc5_ = (t - _loc2_ * (1 / p.length)) * p.length;
var _loc3_ = undefined;
var _loc6_ = undefined;
if(_loc2_ == 0)
{
_loc3_ = b;
_loc6_ = (p[0] + p[1]) / 2;
}
else if(_loc2_ == p.length - 1)
{
_loc3_ = (p[_loc2_ - 1] + p[_loc2_]) / 2;
_loc6_ = e;
}
else
{
_loc3_ = (p[_loc2_ - 1] + p[_loc2_]) / 2;
_loc6_ = (p[_loc2_] + p[_loc2_ + 1]) / 2;
}
return _loc3_ + _loc5_ * (2 * (1 - _loc5_) * (p[_loc2_] - _loc3_) + _loc5_ * (_loc6_ - _loc3_));
}
}